package com.waimai.util;

import javax.servlet.http.HttpServletRequest;

public class SystemUtil {
	
	public static String ROOT_URL = null;
	
	public static String getPhotoUrl(HttpServletRequest request, String photoName){
		ROOT_URL = "http://" + request.getLocalAddr() + ":" + request.getLocalPort() + request.getContextPath();
		if(photoName.contains(ROOT_URL)){
			return photoName;
		}
		return ROOT_URL + "/photos/" + photoName;
	}
	
}
